/*
 *  $Id: GodlyTouch.cs 1051 2010-05-18 22:10:41Z thenn.erannor $
 *	This file is a part of Ragima CCG.
 *	(C) 2008 Ragima development group.
 *
 *	Licensed under the terms of the GNU GPL License version 2.
 *
 */

namespace Ragima.Cards001.Light.Spells {
    public class GodlyTouch: SpellCard<Creature> {
        public GodlyTouch(): base("001_l_s_godly_touch") {
            Level = CompleteLevel.ReadyForTest;
            Element = ElementType.Light;
            Value = 100;
            Target = CreatureTarget.Own;
            AddManaCost(ElementType.Light, 2);
        }

        protected override void DoAction(TargetArgs<Creature> args) {
            args.Target.RemoveAffects(IsGodlyTouchRemoved);
            args.Target.HealBy(NewDamage(args, DamageType.Health, 1));
            args.Target.AddAffect<GodlyTouchAffect>();
            args.Target.State = CreatureState.Tapped;
        }

        private static bool IsGodlyTouchRemoved(Affect affect) {
            return affect is Affects.Venom || affect is Affects.Poison || affect is Affects.Wound || affect is Affects.Scorch;
        }

        private class GodlyTouchAffect: SpellAffect<GodlyTouch> {
            public GodlyTouchAffect(): base(true) {
                DefaultDescription = true;
                Add(new Affects.Fearless());
            }
        }
    }
}
